home *** CD-ROM | disk | FTP | other *** search
- Path: news.luc.edu!news
- From: rolson@luc.edu (Rick Olson)
- Newsgroups: comp.lang.c++
- Subject: Why should I use classes....or should I?
- Date: 28 Mar 1996 01:03:58 GMT
- Organization: Loyola University Chicago
- Message-ID: <4jcohu$7c8@artemis.it.luc.edu>
- NNTP-Posting-Host: 147.126.89.57
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=ISO-8859-1
- X-Newsreader: WinVN 0.99.5
-
- I am an experienced FORTRAN programmer and have a reasonable
- knowledge of C. Most of my programming is related to my research
- which is generally related to constructing and comparing heuristic
- alogorithms for difficult problems. I am about to start a new
- project and am trying to decide whether C++ is appropriate. I'd
- appreciate any feedback.
-
- Suppose I want to compare 10 algorithms for solving a problem (eg
- bin packing). With C I would code the routines for each algorithm
- and then write something to read the data and run it through each
- algorithm printing the results. From where I sit this is pretty
- straight forward. All the algorithms require the same input
- data (perhaps item sizes) and reports the same results (number of
- bins, solution time...). This seems to be a function driven
- application rather than a data driven app.
-
- There are a few features of C++ that are more appealing than C.
- Not needing to pass integer addresses to functions, then dereference
- them is one. Right now I don't see any compelling argument for
- using classes unless it is to learn how they work. In fact, it seems
- to me that if I use classes I will actually pay a performance penalty
- because of the overhead associated with binding functions that can't
- be done at compilation time because of the possibility of polymorphism.
-
- Am I missing something? Is there a reason why I should be trying to
- think in terms of objects rather than thinking of C++ as "a better C".
-
- I would appreciate any personal opinions/experience and pointers to
- good books that may help me understand the *WHY* of OOP for these
- types programs rather than just the *HOW* of classes.
-
- Thanks in advance--
- Rick Olson
-
-